﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using KBEngine;
using System;
using UnityEngine.SceneManagement;

public class Login : MonoBehaviour {

	// Use this for initialization
	void Start ()
    {
        KBEngine.Event.registerOut("onLoginSuccessfully", this, "onLoginSuccessfully");
    }

    public void onBtnLoginClick()
    {
        KBEngine.Event.fireIn("login", "y0005", "123456", System.Text.Encoding.UTF8.GetBytes(Application.platform.ToString()));
    }

    public void onLoginSuccessfully(KBEngine.Account accountEntity)
    {
        //进入农场界面
        print(accountEntity.dbid);
        print(accountEntity.name);
        print(accountEntity.fieldNum);
        foreach (FIELD_INFO field in accountEntity.fieldList)
        {
            print(field.index);
            print(field.cropId);
            print(field.plantTime);
        }
        SceneManager.LoadScene("Farm");
    }
}
